package com.lemi.util;

import com.alibaba.fastjson.JSON;

public class BspResult {

	private String code;//状态码
	private String msg;
	private Object data;
	private boolean success;

	public BspResult() {
		super();
	}
	public BspResult(String code, String msg, Object data,boolean success) {
		super();
		this.code = code;
		this.msg = msg;
		this.data = data;
		this.success = success;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	
	public static Object ok() {
		return ok("", null);
	}
	
	public static Object ok(String msg) {
		return ok(msg, null);
	}
	
	public static Object ok(String msg,Object data) {
		return JSON.toJSON(new BspResult("200", msg, data,true));
	}
	
	public static Object err() {
		return err("");
	}

	public static Object err(String msg) {
		return JSON.toJSON(new BspResult("400", msg, null,false));
	}
	
	public static void main(String[] args) {


	}
}
